from multiprocessing import Process
from time import sleep


'''
start作用
1.开辟进程
2.调用run方法
'''
class MyProcess(Process):
    def __init__(self,name):
        super().__init__()
        self.name=name

    # 重写run方法
    def run(self):
        n=1
        while True:
            sleep(1)
            print('进程名{}-----n:{}'.format(self.name,n))
            n=n+1

if __name__ == '__main__':
    p1=MyProcess('task1')
    p2 = MyProcess('task2')

    p1.start()
    p2.start()